package com.imooc.dianping.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.imooc.dianping.model.Shop;
import com.imooc.dianping.model.User;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface ShopMapper extends BaseMapper<Shop> {

    @Select("select * from shop order by id desc")
    Page<Shop> selectPageOrderById(Page<Shop> page);

    List<Shop> recommend(@Param("longitude") BigDecimal longitude, @Param("latitude") BigDecimal latitude);

    List<Shop> search(@Param("longitude") BigDecimal longitude,
                           @Param("latitude") BigDecimal latitude,
                           @Param("keyword")String keyword,
                           @Param("orderby")Integer orderby,
                           @Param("categoryId")Integer categoryId,
                           @Param("tags")String tags);

    List<Map<String,Object>> searchGroupByTags(@Param("keyword")String keyword,
                                               @Param("categoryId")Integer categoryId,
                                               @Param("tags")String tags);

    List<Map<String,Object>> buildESQuery(@Param("sellerId") Integer sellerId,@Param("categoryId") Integer categoryId,@Param("shopId") Integer shopId);


}
